package com.haochen.generation.controller;

import com.haochen.generation.domain.AjaxResult;
import com.haochen.generation.service.GenTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @Author: zhangquancheng
 * @Description: 代码生成
 * @Date: 2023/3/30 4:22 下午
 */
@RestController
public class GenController extends BaseController{

    @Autowired
    private GenTableService genTableService;

    /**
     * 生成代码（自定义路径）
     */
    @GetMapping("/genCode/{tableName}")
    public AjaxResult genCode(@PathVariable("tableName") String tableName) throws IOException {
        genTableService.generatorCode(tableName);
        return success();
    }

}
